/**
 * 
 */
package com.cqcis.uip.module.salary.oper.dao;

import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.cqcis.uip.base.framework.utils.JdbcUtil;
import com.cqcis.uip.module.salary.oper.SalaryConstants;
import com.cqcis.uip.module.salary.oper.domain.SalaryMain;

/**
 * @author 李世军
 *
 * 创建于 2012-3-10 上午09:54:09
 */
public class SalaryMainDao extends SimpleJdbcDaoSupport {
	private static String INSERT_SQL = " insert into financecontrol_salarymain(employe_id,salarylevel_id,yearfee,monthfee,dayfee,tc_fee,tc_ratio,tc_all_fee,course_fee,course_all_fee,trusteeship_fee,call_fee,performance_no,insure_fee,month,state,remark) " 
									+" values(:employe_id,:salarylevel_id,:yearfee,:monthfee,:dayfee,:tc_fee,:tc_ratio,:tc_all_fee,:course_fee,:course_all_fee,:trusteeship_fee,:call_fee,:performance_no,:insure_fee,:month,:state,:remark) ";
	
	private static String DELETE_SQL = " delete from financecontrol_salarymain  where month>=? and month<=?    " ;
	
	/**
	 * 保存
	 * @param salaryMain
	 */
	public void insert(SalaryMain salary){
		salary.setMonth(SalaryConstants.SALARY_GENERATE_DATE) ;
		salary.setState("0") ;
		JdbcUtil.update(INSERT_SQL, salary, this);
	}
	
	/**
	 * 删除当月数据
	 */
	public void delete(){
		JdbcUtil.update(this, DELETE_SQL, SalaryConstants.SALARY_BEGIN_DATE, SalaryConstants.SALARY_END_DATE);
	}
}
